package com.linzm.leetcode.primary.字符串;

import org.junit.Test;

/**
 * @Author zimingl
 * @Date 2022/10/7 0:34
 * @Description: TODO
 */
public class 字符串344反转字符串 {

    public void reverseString(char[] s) {
        int left = 0;
        int right = s.length - 1;
        while (left < right){
            swap(s, left ++, right --);
        }
    }

    public void swap(char[] nums, int a, int b){
        char temp = nums[a];
        nums[a] = nums[b];
        nums[b] = temp;
    }

    @Test
    public void test(){
        char[] s = {'h','e','l','l','o'};
        reverseString(s);
    }
}
